package databases

import (
	"fmt"

	"github.com/go-xorm/xorm"
	"permission/config"
)

// LogInfoFactory 日志工厂类
type LogInfoFactory struct {
	Table        VigoLog
	engine       *xorm.Engine
	RowsSlicePtr []VigoLog
}

// NewLogInfoFactory 创建日志工厂类
func NewLogInfoFactory() *LogInfoFactory {
	lcginfoFac := LogInfoFactory{}
	lcginfoFac.engine, _ = config.InitLogEng()
	return &lcginfoFac
}

// AddNewLog 添加一条新日志
func (lf *LogInfoFactory) AddNewLog() error {
	_, err := lf.engine.Insert(&lf.Table)
	fmt.Println(err)
	return err
}
